(progn
  (switch-to-buffer "configure")
  
  (while (re-search-forward "-O2" nil t)
    (replace-match "-gdwarf-2 -g3" nil nil))
)


(progn
  (switch-to-buffer "configure")
  (beginning-of-buffer)  
  (while (re-search-forward "\"-O2\"" nil t)
    (replace-match "\"-gdwarf-2 -g3\"" nil nil))

  (beginning-of-buffer)  
  (while (re-search-forward "\"-g\"" nil t)
    (replace-match "\"-gdwarf-2 -g3\"" nil nil))

  (beginning-of-buffer)  
  (while (re-search-forward "\"-g -O2\"" nil t)
    (replace-match "\"-gdwarf-2 -g3\"" nil nil))
)
